package ocean;

import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.BuildCreativeModeTabContentsEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.config.ModConfig;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import ocean.chinacraft.common.ModItems;
import ocean.chinacraft.common.config.ApplicationConfig;
import ocean.chinacraft.common.constants.Constants;

/**
 * 华夏文明2
 *
 * @author zhang
 * @since 2021/11/9
 **/
@Mod(value = Constants.MOD_ID)
public class ChinaCraftApplication {

    public ChinaCraftApplication() {
        MinecraftForge.EVENT_BUS.register(this);
        IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
        ModItems.register(modEventBus);
        modEventBus.addListener(this::doClient);
        modEventBus.addListener(this::commonSetup);
        modEventBus.addListener(this::addCreativeModTab);

        ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, ApplicationConfig.SPEC, "night.toml");
    }

    public void doClient(final FMLClientSetupEvent event) {
        event.enqueueWork(() -> {
        });
    }

    private void commonSetup(final FMLCommonSetupEvent event) {
        event.enqueueWork(() -> {

        });
    }

    private void addCreativeModTab(BuildCreativeModeTabContentsEvent event) {
        ModItems.addCreativeModTab(event);
    }
}
